// 答案
const mongoose = require('mongoose')

const {Schema, model} = mongoose

const AnswerSchema =  {
  __v:{type: Number,select:false},
  author: {type: Schema.Types.ObjectId, ref: 'User', required: true}, // 作者
  content: {type: String, required: true}, // 回答内容
  questionId: {type: Schema.Types.ObjectId, ref: 'Question', required: true}, // 回答从属的问题
  approvedCount: {type: Number, required: true, default: 0}, // 赞同数，默认为0
  commentCount: {type: Number, required: true, default: 0}, // 评论数，默认为0
}

module.exports = model('Answer', AnswerSchema)